.class public Lcom/donson/momark/util/y;
.super Ljava/lang/Object;


# instance fields
.field a:Landroid/location/LocationManager;

.field d:Landroid/location/Location;

.field private e:Ljava/lang/String;

.field private g:Ljava/lang/String;

.field private h:Ljava/lang/String;

.field private j:Ljava/lang/String;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 2

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const-string v0, "network"

    iput-object v0, p0, Lcom/donson/momark/util/y;->e:Ljava/lang/String;

    const-string v0, "gps"

    iput-object v0, p0, Lcom/donson/momark/util/y;->g:Ljava/lang/String;

    const-string v0, "location"

    invoke-virtual {p1, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/location/LocationManager;

    iput-object v0, p0, Lcom/donson/momark/util/y;->a:Landroid/location/LocationManager;

    iget-object v0, p0, Lcom/donson/momark/util/y;->e:Ljava/lang/String;

    invoke-direct {p0, v0}, Lcom/donson/momark/util/y;->a(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/donson/momark/util/y;->d:Landroid/location/Location;

    invoke-virtual {v0}, Landroid/location/Location;->getLatitude()D

    move-result-wide v0

    invoke-static {v0, v1}, Ljava/lang/String;->valueOf(D)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/donson/momark/util/y;->h:Ljava/lang/String;

    iget-object v0, p0, Lcom/donson/momark/util/y;->d:Landroid/location/Location;

    invoke-virtual {v0}, Landroid/location/Location;->getLongitude()D

    move-result-wide v0

    invoke-static {v0, v1}, Ljava/lang/String;->valueOf(D)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/donson/momark/util/y;->j:Ljava/lang/String;

    :goto_0
    return-void

    :cond_0
    iget-object v0, p0, Lcom/donson/momark/util/y;->g:Ljava/lang/String;

    invoke-direct {p0, v0}, Lcom/donson/momark/util/y;->a(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/donson/momark/util/y;->d:Landroid/location/Location;

    invoke-virtual {v0}, Landroid/location/Location;->getLatitude()D

    move-result-wide v0

    invoke-static {v0, v1}, Ljava/lang/String;->valueOf(D)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/donson/momark/util/y;->h:Ljava/lang/String;

    iget-object v0, p0, Lcom/donson/momark/util/y;->d:Landroid/location/Location;

    invoke-virtual {v0}, Landroid/location/Location;->getLongitude()D

    move-result-wide v0

    invoke-static {v0, v1}, Ljava/lang/String;->valueOf(D)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/donson/momark/util/y;->j:Ljava/lang/String;

    goto :goto_0

    :cond_1
    const-string v0, "PhoneLocate.initLocation:"

    const-string v1, "not open GPS device"

    invoke-static {v0, v1}, Lcom/donson/momark/util/t;->d(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0
.end method

.method private a(Ljava/lang/String;)Z
    .locals 1

    iget-object v0, p0, Lcom/donson/momark/util/y;->a:Landroid/location/LocationManager;

    invoke-virtual {v0, p1}, Landroid/location/LocationManager;->getLastKnownLocation(Ljava/lang/String;)Landroid/location/Location;

    move-result-object v0

    if-eqz v0, :cond_0

    iput-object v0, p0, Lcom/donson/momark/util/y;->d:Landroid/location/Location;

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method


# virtual methods
.method public a()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/donson/momark/util/y;->h:Ljava/lang/String;

    return-object v0
.end method

.method public d()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/donson/momark/util/y;->j:Ljava/lang/String;

    return-object v0
.end method
